<?php

namespace app\api\controller;

use app\api\service\UserService;
use app\api\validate\UserValidate;

class User extends Base
{
    protected $middleware = ['NotFoundMiddleware'];

    /**
     * 根据device获取用户
     * @needLogin FALSE
     * @method GET
     * @return void
     */
    public function getUserInfo()
    {
        list($code, $msg, $data) = UserService::getUserInfo($this->_device_id);
        apiReturn($code, $msg, $data);
    }

    /**
     * 根据用户挑战
     * @needLogin TRUE
     * @method GET
     * @return void
     */
    public function getUserChallenge()
    {
        list($code, $msg, $data) = UserService::getUserChallenge($this->_user_info);
        apiReturn($code, $msg, $data);
    }

    /**
     * 根据用户记录
     * @needLogin TRUE
     * @method GET
     * @return void
     */
    public function getUserRecord()
    {
        list($code, $msg, $data) = UserService::getUserRecord($this->_user_info);
        apiReturn($code, $msg, $data);
    }
}